﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace AfterCaveStory.Objetos.Platformer.Personagens
{
    class Tiro : PhysicsObject
    {
        float angle;
        

        public Tiro(Texture2D textura, Nullable<Rectangle> sourceRectangle, float depth, float x, float y, float angle)
            : base(textura, sourceRectangle, depth)
        {
            this.x = x;
            this.y = y;
            this.isStatic = false;
            this.angle = angle;
        }

        public override void update(World world)
        {
            this.x += (float) Math.Cos(MathHelper.ToRadians(angle)) * 10;
            this.y += (float) Math.Sin(MathHelper.ToRadians(angle)) * 10;
            base.update(world);
        }

        protected override void verifyGravity(World world)
        {
            
        }

        protected override void handlePlatformCollision(World world, PhysicsObject platform)
        {
            world.removeObject(this);
        }
    }
}
